#ifndef _WX_PAPERH__
#define _WX_PAPERH__

#include "wx/defs.h"
#include "wx/event.h"
#include "wx/cmndata.h"
#include "wx/intl.h"
#include "wx/hashmap.h"

#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)

class wxPrintPaperType: public wxObject {
  public:
    wxPrintPaperType();
    wxPrintPaperType( wxPaperSize paperId, int platformId, const wxString& name, int w, int h );
    inline wxString GetName() const { return wxGetTranslation( m_paperName ); }
    inline wxPaperSize GetId() const { return m_paperId; }
    inline int GetPlatformId() const { return m_platformId; }
    inline int GetWidth() const { return m_width; }
    inline int GetHeight() const { return m_height; }
    inline wxSize GetSize() const { return wxSize( m_width, m_height ); }
    inline wxSize GetSizeMM() const { return wxSize( m_width / 10, m_height / 10 ); }
    wxSize GetSizeDeviceUnits() const ;
  public:
    wxPaperSize m_paperId;
    int         m_platformId;
    int         m_width;  // In tenths of a millimetre
    int         m_height; // In tenths of a millimetre
    wxString    m_paperName;
  private:
    DECLARE_DYNAMIC_CLASS( wxPrintPaperType )
};

WX_DECLARE_STRING_HASH_MAP( wxPrintPaperType*, wxStringToPrintPaperTypeHashMap );
class wxPrintPaperTypeList;

class wxPrintPaperDatabase {
  public:
    wxPrintPaperDatabase();
    ~wxPrintPaperDatabase();
    void CreateDatabase();
    void ClearDatabase();
    void AddPaperType( wxPaperSize paperId, const wxString& name, int w, int h );
    void AddPaperType( wxPaperSize paperId, int platformId, const wxString& name, int w, int h );
    wxPrintPaperType *FindPaperType( const wxString& name );
    wxPrintPaperType *FindPaperType( wxPaperSize id );
    wxPrintPaperType *FindPaperTypeByPlatformId( int id );
    wxPrintPaperType *FindPaperType( const wxSize& size );
    wxPaperSize ConvertNameToId( const wxString& name );
    wxString ConvertIdToName( wxPaperSize paperId );
    wxSize GetSize( wxPaperSize paperId );
    wxPaperSize GetSize( const wxSize& size );
    wxPrintPaperType* Item( size_t index ) const;
    size_t GetCount() const;
  private:
    wxStringToPrintPaperTypeHashMap* m_map;
    wxPrintPaperTypeList* m_list;
};

extern wxPrintPaperDatabase* wxThePrintPaperDatabase;

#endif
